<template>
  <div v-show="datas">
      <div class="contimg">
            <div class="imgtexts" v-if="shows==2">
                <div class="imgtext" v-if="datas.retCode=='0000'">
                    <img src="../img/cg.png" alt="">
                    <span style="color: #65D4C0;">账户挂失成功</span>
                </div>
                <div class="imgtext" v-else>
                    <img src="../img/sb.png" alt="">
                    <span >账户挂失失败</span>
                </div>
                <div style="text-align:center;font-size: 14px;">
                        {{datas.retMsg}}
                </div>
            </div>
            <!--  -->
            <div class="imgtexts" v-else>
                <div class="imgtext" v-if="datas.retCode=='0000'">
                    <img src="../img/cg.png" alt="">
                    <span style="color: #65D4C0;">绑卡成功</span>
                </div>
                <div class="imgtext" v-else>
                    <img src="../img/sb.png" alt="">
                    <span >绑卡失败</span>
                </div>
                <div style="text-align:center;font-size: 14px;">
                        {{datas.retMsg}}
                </div>
            </div>
      </div>
      <div class="contimgs">
          <!-- 挂失 -->
            <div class="cardNumber" v-if="shows==2"> 
              <span style="color: #999999;">卡号：</span>
              <div>{{datas.cardNo}}</div>
          </div> 
          <!-- 换卡 -->
          <div class="cardNumber" v-else> 
              <span style="color: #999999;">卡号：</span>
              <div>{{datas.newCardNo}}</div>
          </div>
            <div class="times"> 
              <span style="color: #999999;">时间：</span>
              <div>{{times}}</div>
          </div>
      </div>
        <div class="addbut" @click="addres">
            完成
        </div>
  </div>
</template>

<script>
export default {
    data(){
        return{
            datas:{},
            times:'',
            shows:''
        }
    },
    mounted(){
        console.log("结果",JSON.parse(this.$route.query.id),JSON.parse(this.$route.query.No) )
        this.shows=JSON.parse(this.$route.query.No) 
        this.datas=JSON.parse(this.$route.query.id)
        this.times=this.getFormtTime().timestamp
    },
    methods:{
    addres(){
        let embedding = {
            eventID:"accountloseAddres",
            extra:{
                name:"账户挂失确认"
            },
        };
        BmacJSBridge.call("AddEventburyPoints",embedding,(data)=>{})
        console.log("0")
        if(this.shows==2){
            this.$router.go(-2)
        }else{
            this.$router.go(-3)
        }
        
    },
    getFormtTime() {
      let datetime = new Date();
      let currentTime = {};
      let year = datetime.getFullYear().toString();
      let month = datetime.getMonth() + 1;
      month = this.replenishZero(month);
      let date = datetime.getDate();
      date = this.replenishZero(date);
      currentTime.reqDate = year + month + date;
      currentTime.reqDateStr = year + "-" + month + "-" + date;
      currentTime.startDate = year + month + "01";
      currentTime.startDateStr = year + "-" + month + "-" + "01";
      let hour = datetime.getHours();
      hour = this.replenishZero(hour);
      let minute = datetime.getMinutes();
      minute = this.replenishZero(minute);
      let second = datetime.getSeconds();
      second = this.replenishZero(second);
      //currentTime.reqTime = hour + minute + second;
      currentTime.timestamp = year +"-"+ month +"-"+ date + " " + hour +":"+ minute +":"+ second;
      return currentTime;
    },
    /**
     * [单位数补零]
     */
    replenishZero(num) {
      let beautyNum = Number(num) < 10 ? "0" + num : num;
      return beautyNum.toString();
    },
    }
}
</script>

<style lang="stylus" rel="stylesheet/stylus" scoped>
@import '../../../common/stylus/mixin.styl';
.contimg{
    height 1.76rem;
    background #ffffff;
    padding:0 0.32rem;
    
    .imgtexts{
        font-size 17px;
        height 100%;
        position relative;
    }
    .imgtext{
        font-size 17px;
        padding:0.5rem 0 0.2rem 0;
        display flex;
        align-items center;
        justify-content center;
        img{
            display inline-block;
            height 0.48rem;
            width:0.48rem;
            margin-right 10px;
        }
        span{
            font-size 17px
        }
    }
    .imgtexts:after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0rem;
        background: #e6e6e6;
        width: 100%;
        height: 1px;
        -webkit-transform: scaleY(0.5);
        transform: scaleY(0.5);
        -webkit-transform-origin: 0 0;
        transform-origin: 0 0;
      }
}
.contimgs{
    height 2rem;
    background #ffffff;
    padding:0 0.32rem; 
    .cardNumber{
        display flex;
        justify-content space-between;
        font-size 14px;
        padding-top:0.48rem;
    }
    .times{
        display flex;
        justify-content space-between;
        font-size 14px;
        padding-top:0.32rem;
    }
}
.addbut{
    font-size: 14px;
    color: #FFFFFF;
background: #008DEE;
border-radius: 4px;

    height 0.88rem;
    margin:0.32rem;
    text-align center;
    line-height 0.88rem;
}
</style>